define(
   [
      'dojo/_base/declare',
      'dojo/_base/lang',
      'dijit/_HasDropDown',
      'dijit/form/ValidationTextBox',
      'noBusinessBase/widgets/IconPicker'
   ],
   function(declare, lang, _HasDropDown, ValidationTextBox, IconPicker)
   {
      return declare("noBusinessBase/widgets/IconTextBox", [ValidationTextBox, _HasDropDown],
      {
         baseClass: "dijitTextBox dijitComboBox noBusinessBaseIconTextBox",
         popupClass: "noBusinessBase/widgets/IconPicker",
      
         // hasDownArrow: [const] Boolean
         //    Set this textbox to display a down arrow button, to open the drop down list.
         hasDownArrow: true,
      
         // openOnClick: [const] Boolean
         //    Set to true to open drop down upon clicking anywhere on the textbox.
         openOnClick: true,
      
         // flag to _HasDropDown to make drop down Calendar width == <input> width
         forceWidth: false,
      
         dropDownDefaultValue: "",
      
         value: "",
      
         buildRendering: function(){
            this.inherited(arguments);
      
            if(!this.hasDownArrow){
               this._buttonNode.style.display = "none";
            }
      
            // If openOnClick is true, we basically just want to treat the whole widget as the
            // button.  We need to do that also if the actual drop down button will be hidden,
            // so that there is a mouse method for opening the drop down.
            if(this.openOnClick || !this.hasDownArrow){
               this._buttonNode = this.domNode;
               this.baseClass += " dijitComboBoxOpenOnClick";
            }
         },
         openDropDown: function(callback){
            // rebuild drop down every time, so that constraints get copied (#6002)
            if(this.dropDown){
               this.dropDown.destroy();
            }
            var PopupProto = lang.getObject(this.popupClass, false),
               textBox = this,
               value = this.get("value");
            this.dropDown = new PopupProto({
               onChange: function(value){
                  textBox.attr('value', value);
               },
               id: this.id + "_popup",
               dir: textBox.dir,
               lang: textBox.lang,
               value: value,
               currentFocus: value,
               textBoxValue: this.get("value")
            });
   
            this.inherited(arguments);
         }
      });
   }
);
